package com.guigu.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.guigu.pojo.GatherInfo;
import com.guigu.pojo.PayInfo;
import com.guigu.service.PayInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@CrossOrigin
@RestController
@RequestMapping("/payInfo/")
public class PayInfocontroller {
    @Autowired
    PayInfoService payInfoService;

    //分页查询
    @GetMapping("payInfo.action")
    public Page<PayInfo> queryAll(PayInfo payInfo,
                                        @RequestParam(value = "pageno",defaultValue = "1")Integer pageno,
                                        @RequestParam(value = "pagesize",defaultValue = "5")Integer pagesize){
        return payInfoService.queryAll(payInfo,pageno,pagesize);
    }

    //根据订单数组ids，添加出库表和出库详情表数据，出库表需要审核
    @PostMapping("addPayInfoandDetailPurchaseInfo.action")
    public Map addGatherInfoAndDetailPurchaseInfo(Integer[] ids){
        return  payInfoService.addPayInfoandDetailPurchaseInfo(ids);
    }

    //审核出库单
    @PutMapping("audit.action")
    public Map audit(@RequestBody PayInfo payInfo){
        return payInfoService.audit(payInfo);
    }
}
